<!-- 班组人员统计表 -->
<template>
	<view class="flex-page">
		<bg-search placeholder="请输入班组姓名" @search="searchHandler">
			<view class="flex align-center justify-center pt-4 font-12 text-grey1">
				<view class="search-reslut">
					共计班组<text class="font-red">{{total}}</text>人
				</view>
			</view>
		</bg-search>
		<view class="content-wrap mt-2 flex-1 bg-white">
			<u-list style="height:calc(100vh - 280rpx)" @scrolltolower="loadMore">
				<bg-cell2 v-for="u,idx in dataList" :key="idx" :show-arrow="true" @click="onTap(u)">
					<template slot="label">
						<view class="font-12">
							<text class="text-red mr-1"> [{{u.workJobTypeName}}] </text>
							<text class="text-grey3"> {{u.userName}} </text>
							<text class="text-grey3">（{{u.idCardNo}}）</text>
						</view>
					</template>
				</bg-cell2>
			</u-list>
			
			
			
		</view>
	</view>
</template>

<script>
	import {getEntryUsers} from "@/api/entry.js"
	export default {
		data() {
			return {
				dataList:[],
				params:{
					projectId:'',
					pageNum:1,
					pageSize:20,
					userName:''
				},
				total:0,
			}
		},
		onLoad(options){
			this.params.projectId = options.pid
			this.getData()
		},
		methods: {
			getData(){
				getEntryUsers(this.params).then(res=>{
					this.dataList = res.data.rows
					this.total = res.data.total
					
				})
			},
			loadMore(){
				if(this.dataList.length>this.total){
					this.params.pageNum+=1
					this.getData()
				}
			},
			searchHandler(e){
				this.params.userName = e
				this.params.pageNum = 1
				this.dataList = []
				this.getData()
			},
			onTap(i){
				uni.navigateTo({
					url:"/pages/attendance/statistics/person-detail?userId="+i.userId+"&entryId="+i.entryId
				})
			}
		}
	}
</script>

<style>
.search-reslut {
	
}
</style>